Skip to content

feat(lineage): add lineage visualization across datasets, charts and dashboards#40912

Open
rusackas wants to merge 4 commits into
masterfrom
adopt/lineage-visualization
Open

feat(lineage): add lineage visualization across datasets, charts and dashboards#40912
rusackas wants to merge 4 commits into
masterfrom
adopt/lineage-visualization

Conversation

@rusackas

@rusackas rusackas commented Jun 9, 2026

Copy link
Copy Markdown
Member

SUMMARY

Adopts #37701 by @qf-jonathan — thank you for the substantial work here! 🙏

Adds interactive Sankey-based lineage that lets users explore data relationships:

  • Dataset lineage — upstream database and downstream charts/dashboards
  • Chart lineage — database → dataset → chart → dashboards pipeline
  • Dashboard lineage — all upstream databases, datasets and charts feeding a dashboard

Implementation: three REST endpoints (/api/v1/lineage/{dataset|chart|dashboard}/<id>) with permissions + integration tests, and a LineageView/LineageModal frontend (ECharts Sankey) surfaced from the dataset editor and the chart/dashboard action menus.

What changed vs. the original PR

Rebased onto current master and updated for drift accumulated since the original branch (Feb):

  • Resolved merge conflicts in constants.py, ChartCard, useHeaderActionsDropdownMenu, and the chart integration tests.
  • Repointed the lineage imports from the now-removed @apache-superset/core/ui to @apache-superset/core/translation and /theme (the package layout changed).
  • Re-applied the dataset lineage tab onto the migrated (TypeScript) DatasourceEditor (it was .jsx when the original PR was written).

TESTING INSTRUCTIONS

Open a dataset → Lineage tab; open a chart/dashboard menu → Lineage; verify the Sankey renders upstream/downstream relationships.

Backend: pytest tests/integration_tests/{charts,dashboards,datasets}/api_tests.py -k lineage

Verification status (honest notes for reviewers)

  • ✅ Backend static checks pass locally (mypy, ruff, pylint, license headers).
  • ✅ Frontend: prettier clean; the adopted TS files type-check cleanly after the import fixes.
  • ⚠️ oxlint and the backend integration tests weren't run in my environment (no DB); CI will exercise both.
  • ⚠️ End-to-end feature behavior is best confirmed with a manual smoke test in a running instance.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

Closes #37701

🤖 Generated with Claude Code

…dashboards

Adopts #37701 by @qf-jonathan. Adds interactive Sankey-based lineage that shows
the data relationships for a dataset, chart, or dashboard: three REST endpoints
(/api/v1/lineage/{dataset|chart|dashboard}/<id>) plus a LineageView/LineageModal
frontend surfaced from the dataset editor and the chart/dashboard menus.

Rebased onto current master and updated for drift since the original branch:
- repointed lineage imports from the removed '@apache-superset/core/ui' to
  '@apache-superset/core/translation' and '/theme'
- re-applied the dataset lineage tab onto the migrated (TypeScript) DatasourceEditor

Closes #37701

Co-authored-by: Jonathan Alberth Quispe Fuentes <qf.jonathan@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the api Related to the REST API label Jun 9, 2026
@sadpandajoe sadpandajoe added the review:checkpoint Last PR reviewed during the daily review standup label Jun 9, 2026
Comment thread superset-frontend/src/features/lineage/LineageView.tsx Outdated
Comment thread superset/datasets/api.py
@dosubot dosubot Bot added change:backend Requires changing the backend change:frontend Requires changing the frontend viz:charts:sankey Related to the Sankey chart labels Jun 9, 2026
Comment thread superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx Outdated
Comment thread superset-frontend/src/features/lineage/LineageModal.tsx
Comment thread superset-frontend/src/features/lineage/LineageView.tsx Outdated
Comment thread superset-frontend/src/features/lineage/LineageView.tsx Outdated
Comment thread superset/dashboards/api.py
Comment thread superset/dashboards/api.py
Comment thread superset/datasets/api.py Outdated
Comment thread superset/datasets/api.py
Comment thread tests/integration_tests/charts/api_tests.py Outdated
Comment thread superset-frontend/src/hooks/apiResources/lineage.ts Outdated
Comment thread superset/charts/api.py
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.76569% with 221 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.08%. Comparing base (58d29e0) to head (766b4a8).
⚠️ Report is 53 commits behind head on master.

Files with missing lines Patch % Lines
...rset-frontend/src/features/lineage/LineageView.tsx 6.19% 197 Missing ⚠️
superset/charts/api.py 74.07% 4 Missing and 3 partials ⚠️
superset/datasets/api.py 80.00% 3 Missing and 3 partials ⚠️
...e/components/DatasourceEditor/DatasourceEditor.tsx 0.00% 5 Missing ⚠️
...set-frontend/src/features/lineage/LineageModal.tsx 88.88% 2 Missing ⚠️
...mponents/useExploreAdditionalActionsMenu/index.tsx 66.66% 1 Missing ⚠️
...uperset-frontend/src/features/charts/ChartCard.tsx 94.11% 1 Missing ⚠️
...frontend/src/features/dashboards/DashboardCard.tsx 94.11% 1 Missing ⚠️
superset/dashboards/api.py 95.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40912      +/-   ##
==========================================
- Coverage   64.13%   64.08%   -0.06%     
==========================================
  Files        2653     2657       +4     
  Lines      143606   144171     +565     
  Branches    33132    33258     +126     
==========================================
+ Hits        92105    92392     +287     
- Misses      49888    50157     +269     
- Partials     1613     1622       +9     
Flag Coverage Δ
hive 39.55% <66.84%> (+0.05%) ⬆️
javascript 67.72% <28.86%> (-0.16%) ⬇️
mysql 58.33% <92.51%> (+0.08%) ⬆️
postgres 58.39% <92.51%> (+0.08%) ⬆️
presto 41.14% <66.84%> (+0.04%) ⬆️
python 59.86% <92.51%> (+0.07%) ⬆️
sqlite 58.02% <92.51%> (+0.08%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Wrap untranslated "Details" JSX text in t() (fixes pre-commit custom
  rules + babel-extract regression)
- Filter dataset/chart/dashboard lineage endpoints by the current user's
  permissions so they never expose charts, dashboards, or datasource
  metadata the user cannot access (mirrors existing related_objects /
  get_datasets redaction patterns)
- Register DashboardLineageResponseSchema in openapi_spec_component_schemas
  to resolve the dangling $ref in the generated API spec
- Key Sankey graph nodes and the node-details map by a stable unique
  identity (type:id) so entities sharing a display name no longer collapse
  into a single node; keep the human-readable title as a separate label
- Add a skip mechanism to useApiV1Resource / lineage hooks so empty-id
  callers (e.g. LineageModal) no longer fire requests against invalid
  endpoints like /api/v1/chart//lineage
- Defer the dataset edit page lineage fetch until the Lineage tab is active
- Make "View lineage" available in dashboard view mode, not only edit mode
- Compare data["result"] in lineage integration tests to match the
  result-wrapped API contract

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #9dcb5b

Actionable Suggestions - 4
  • superset/dashboards/api.py - 1
  • superset-frontend/src/features/lineage/LineageView.tsx - 2
  • superset-frontend/src/features/lineage/LineageModal.tsx - 1
    • Unconditional hook calls waste resources · Line 40-46
Additional Suggestions - 9
  • superset-frontend/src/features/lineage/LineageModal.tsx - 1
    • Missing unit tests for new component · Line 1-79
      The new LineageModal component lacks unit tests. Per project guidelines, new features should include tests covering success paths, error scenarios, and edge cases.
  • superset/charts/api.py - 1
    • CWE-285: Improper Authorization · Line 353-356
      ChartDAO.get_by_id_or_uuid() applies ChartFilter which returns no results for unauthorized users, causing ChartNotFoundError to be raised. This design conflates 'not found' with 'access denied'. Consider refactoring to raise ChartAccessDeniedError when filters deny access.
  • superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx - 1
    • Redundant Loading state · Line 432-438
      The `DatasetLineageTab` wrapper calls `useDatasetLineage(datasourceId ?? 0)` even when `datasourceId` is undefined, triggering a spurious `/api/v1/dataset/0/lineage` request. The check at line 434 then renders `` anyway, duplicating `LineageView`'s own loading state. Since the parent at line 2536 already has a non-null `datasource.id`, either pass the resource as a prop or return `null` for falsy `datasourceId`.
  • tests/integration_tests/charts/api_tests.py - 1
    • Unused import with noqa · Line 53-53
      The `client` import on line 53 has `# noqa: F401` but is not referenced anywhere in the diff. Either remove it or add a comment explaining why it's needed as a module-level import.
  • superset-frontend/src/features/charts/ChartCard.tsx - 1
    • Missing test identifier · Line 105-126
      The new lineage menu item is missing a `data-test` attribute, making it inconsistent with DashboardCard (which has `data-test="dashboard-card-option-lineage-button"` at line 112). This will hinder automated testing of the ChartCard component.
  • superset/dashboards/schemas.py - 1
    • Missing allow_none for optional field · Line 564-567
      The `slug` field should specify `allow_none=True` to match the API behavior where `dash.slug` can be None. Without this, marshmallow serialization may raise an error when encountering null values.
      Code suggestion
      --- a/superset/dashboards/schemas.py
      +++ b/superset/dashboards/schemas.py
       @@ -563,7 +563,7 @@ class DashboardLineageDashboardSchema(Schema):
        class DashboardLineageDashboardSchema(Schema):
            id = fields.Integer()
            title = fields.String()
      -    slug = fields.String()
      +    slug = fields.String(allow_none=True)
            published = fields.Boolean()
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx - 1
    • Inconsistent test attribute naming · Line 1042-1042
      The `data-test` attribute `view-lineage-menu-item` conflicts with the existing convention in `DashboardCard.tsx` (line 112) which uses `dashboard-card-option-lineage-button` for similar lineage menu items. Use `view-lineage-menu-item-button` to maintain consistent test selector naming across the explore and dashboard features.
  • tests/integration_tests/dashboards/api_tests.py - 1
    • Unused import in test file · Line 72-72
      The `lineage_test_data` fixture is imported but never used in this file. The `inject_expected_dashboard_lineage` fixture (line 70-71) already depends on `lineage_test_data` internally, so this direct import is redundant.
      Code suggestion
      --- tests/integration_tests/dashboards/api_tests.py
      +++ tests/integration_tests/dashboards/api_tests.py
       @@ -68,8 +68,7 @@
        )
        from tests.integration_tests.fixtures.client import client  # noqa: F401
        from tests.integration_tests.fixtures.lineage import (
            inject_expected_dashboard_lineage,  # noqa: F401
      -    lineage_test_data,  # noqa: F401
        )
        from tests.integration_tests.fixtures.world_bank_dashboard import (
  • superset-frontend/src/hooks/apiResources/index.ts - 1
    • Missing unit tests for lineage hooks · Line 32-32
      The `lineage.ts` module exports 3 API hooks but lacks a corresponding test file. Other modules in this directory (dashboards, datasets, queries, etc.) have dedicated `.test.ts` files following the established pattern. Per BITO.md rule [11730], new tools should include comprehensive unit tests covering success paths, error scenarios, validation failures, and edge cases.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/dashboards/api.py - 1
  • superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx - 1
  • superset-frontend/src/features/lineage/LineageView.tsx - 2
  • superset/charts/api.py - 1
  • superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx - 1
Review Details
  • Files reviewed - 23 · Commit Range: 23123ce..23123ce
    • superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx
    • superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx
    • superset-frontend/src/dashboard/types.ts
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/features/charts/ChartCard.tsx
    • superset-frontend/src/features/dashboards/DashboardCard.tsx
    • superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx
    • superset-frontend/src/features/lineage/LineageModal.tsx
    • superset-frontend/src/features/lineage/LineageView.tsx
    • superset-frontend/src/features/lineage/index.ts
    • superset-frontend/src/hooks/apiResources/index.ts
    • superset-frontend/src/hooks/apiResources/lineage.ts
    • superset/charts/api.py
    • superset/charts/schemas.py
    • superset/constants.py
    • superset/dashboards/api.py
    • superset/dashboards/schemas.py
    • superset/datasets/api.py
    • superset/datasets/schemas.py
    • tests/integration_tests/charts/api_tests.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/integration_tests/datasets/api_tests.py
    • tests/integration_tests/fixtures/lineage.py
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/dashboards/api.py
Comment thread superset-frontend/src/features/lineage/LineageView.tsx
Comment thread superset-frontend/src/features/lineage/LineageView.tsx
Comment thread superset-frontend/src/features/lineage/LineageModal.tsx
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4326563
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a28541001e02f0008c69fef
😎 Deploy Preview https://deploy-preview-40912--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #e7785a

Actionable Suggestions - 1
  • superset-frontend/src/hooks/apiResources/apiResources.ts - 1
    • Missing unit tests for skip parameter · Line 89-89
Additional Suggestions - 1
  • superset/charts/api.py - 1
    • Test coverage gap for permission filter · Line 389-395
      The existing test `test_get_chart_lineage` uses `ADMIN_USERNAME` and will continue to pass. Consider adding a test with a non-admin user who has access to only some dashboards to verify the permission filtering is effective.
Review Details
  • Files reviewed - 12 · Commit Range: 23123ce..f8f4010
    • superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx
    • superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx
    • superset-frontend/src/features/lineage/LineageView.tsx
    • superset-frontend/src/hooks/apiResources/apiResources.ts
    • superset-frontend/src/hooks/apiResources/lineage.ts
    • superset/charts/api.py
    • superset/dashboards/api.py
    • superset/datasets/api.py
    • tests/integration_tests/charts/api_tests.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/integration_tests/datasets/api_tests.py
    • superset-frontend/src/hooks/apiResources/lineage.test.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset-frontend/src/hooks/apiResources/apiResources.ts
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #8416a4

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/hooks/apiResources/apiResources.test.ts - 1
    • Incomplete toggle scenario coverage · Line 118-141
      The toggle test only covers the happy path (true→false). Consider adding a symmetric test for skip=false→true to verify the hook correctly returns to loading state without triggering a fetch when skipping is re-enabled.
      Code suggestion
      --- superset-frontend/src/hooks/apiResources/apiResources.test.ts (lines 141-142)
       141:       });
       142:     });
      +   
      +   test('returns to loading when skip toggles from false to true', async () => {
      +     const fetchMock = jest.fn().mockResolvedValue(fakeApiResult);
      +     (makeApi as any).mockReturnValue(fetchMock);
      +     const { result, rerender } = renderHook(
      +       ({ skip }) => useApiResourceFullBody('/test/endpoint', skip),
      +       { initialProps: { skip: false } },
      +     );
      +     await act(async () => {
      +       jest.runAllTimers();
      +     });
      +     expect(fetchMock).toHaveBeenCalledTimes(1);
      +     expect(result.current.status).toEqual(ResourceStatus.Complete);
      +
      +     rerender({ skip: true });
      +     await act(async () => {
      +       jest.runAllTimers();
      +     });
      +     expect(fetchMock).toHaveBeenCalledTimes(1);
      +     expect(result.current).toEqual({
      +       status: ResourceStatus.Loading,
      +       result: null,
      +       error: null,
      +     });
      +   });
           });
Review Details
  • Files reviewed - 1 · Commit Range: f8f4010..766b4a8
    • superset-frontend/src/hooks/apiResources/apiResources.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@apache apache deleted a comment from github-actions Bot Jun 10, 2026
@rusackas rusackas added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API change:backend Requires changing the backend change:frontend Requires changing the frontend review:checkpoint Last PR reviewed during the daily review standup 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR size/XXL viz:charts:sankey Related to the Sankey chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants